package it.tukano.fun;

/**
 * Returns true if an instance equals the argument of the function
 * @author pgi
 */
public class Equals implements Function1<Object, Boolean> {
    private final Object instance;

    /**
     * Instance initializer
     */
    public Equals(Object instance) {
        this.instance = instance;
    }

    /**
     * Checks if p equals the instance used in the constructor
     * @param p the instance to check
     * @return true if instance.equals(p)
     */
    public Boolean apply(Object p) {
        return instance.equals(p);
    }
}
